#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <Dynamics/Damping/velocity_damping_cuda.h>
#include <string>
using namespace PhysLeo;
namespace py = pybind11;

template<typename T>
static void declareVelocityDampingCpu(py::module &mod, const std::string &typestr)
{
    using class_type = VelocityDampingCpu<T>;
    auto pyclass_name = std::string("VelocityDampingCpu") + typestr;
    py::class_<class_type, std::shared_ptr<class_type>>cls(mod, pyclass_name.c_str());

    cls.def(py::init());
    cls.def("allocateResource", &class_type::allocateResource);
    cls.def("getVelocityDampingParam", &class_type::getVelocityDampingParam);
    cls.def("setVelocityDampingParam", &class_type::setVelocityDampingParam);
    cls.def("addDampingForce", &class_type::addDampingForce);
}

template<typename T>
static void declareVelocityDampingCuda(py::module &mod, const std::string &typestr)
{
    using class_type = VelocityDampingCuda<T>;
    using base_type = VelocityDampingCpu<T>;
    auto pyclass_name = std::string("VelocityDampingCuda") + typestr;
    py::class_<class_type, base_type, std::shared_ptr<class_type>>cls(mod, pyclass_name.c_str());

    cls.def(py::init());
    cls.def("addDampingForce", &class_type::addDampingForce);
}

void initVelocityDamping(py::module &m)
{
    declareVelocityDampingCpu<float>(m, std::string("F"));
    declareVelocityDampingCpu<double>(m, std::string("D"));

    declareVelocityDampingCuda<float>(m, std::string("F"));
    declareVelocityDampingCuda<double>(m, std::string("D"));
}
